using System;
using System.Collections.Generic;
using System.Text;
using Firestarter.DB.Schema.BO;
using Habanero.BO;
using Habanero.Faces.Base;
using Habanero.Faces.Win;
using FireStarterModeller.BO;

namespace Firestarter.DB.Schema.UI
{
    public class ApproveModelModificationsWizardStep : WizardStepWin
    {
        private ReverseEngineering _reverseEngineering;
        private readonly ModelModificationsControl _modelModificationsControl;
        //private SingleRelationship<DBDatabase> _storedDatabaseInfoRelationship;

        public ApproveModelModificationsWizardStep()
        {
            IControlFactory factory = GlobalUIRegistry.ControlFactory;
            BorderLayoutManager layoutManager = factory.CreateBorderLayoutManager(this);
            _modelModificationsControl = new ModelModificationsControl();
            layoutManager.AddControl(_modelModificationsControl, BorderLayoutManager.Position.Centre);
        }

        public BusinessObjectCollection<ModelModification> ModelModifications
        {
            get { return _modelModificationsControl.ModelModifications; }
        }

        public ReverseEngineering ReverseEngineering
        {
            get { return _reverseEngineering; }
            set
            {
                _reverseEngineering = value;
                BusinessObjectCollection<ModelModification> modelModifications = null;
                if (_reverseEngineering != null) modelModifications = _reverseEngineering.ModelModifications;
                _modelModificationsControl.ModelModifications = modelModifications;
            }
        }

        #region Implementation of IWizardStep

        /// <summary>
        ///             Initialises the step. Run when the step is reached.
        /// </summary>
        public override void InitialiseStep()
        {

        }

        /// <summary>
        ///             Verifies whether this step can be passed.
        /// </summary>
        /// <param name="message">Error message should moving on be disallowed. This message will be displayed to the user by the WizardControl.</param>
        public override bool CanMoveOn(out string message)
        {
            throw new System.NotImplementedException();//TODO Mark 21 Jan 2009: Implement this
        }

        /// <summary>
        ///             Verifies whether the user can move back from this step.
        /// </summary>
        public override bool CanMoveBack()
        {
            return true;
        }

        /// <summary>
        ///             Provides an interface for the developer to implement functionality to cancel any edits made as part of this
        ///             wizard step. The default wizard controller functionality is to call all wizard steps cancelStep methods when
        ///             its Cancel method is called.
        /// </summary>
        public override void CancelStep()
        {
            throw new System.NotImplementedException(); //TODO Mark 21 Jan 2009: Implement this
        }

        /// <summary>
        /// The text that you want displayed at the top of the wizard control when this step is active.
        /// </summary>
        public override string HeaderText
        {
            get { return "Approve the Domail Model modifications."; }
        }

        public ModelModificationsControl ModelModificationsControl
        {
            get { return _modelModificationsControl; }
        }

        #endregion
    }
}
